package vip

import (
	"github.com/beherochuling/beesoft_api/app/helper/net"
	"github.com/beherochuling/beesoft_api/app/model"
	vipModel "github.com/beherochuling/beesoft_api/app/model/vip"
	"github.com/beherochuling/beesoft_api/app/service"
	"github.com/beherochuling/beesoft_api/app/service/vip"
	"github.com/gogf/gf/v2/net/ghttp"
)

var Activity activity

type activity struct{}

func (activity) Show(r *ghttp.Request) {
	errCode, res := vip.Activity.Show(r.Context(), r.Get("slug").String())
	if errCode != model.SuccessCode {
		net.NewResponse(r).ResponseException(net.NewException(errCode))
	}
	net.NewResponse(r).ResponseOk(res)
}
func (activity) Attend(r *ghttp.Request) {
	var req *vipModel.ActivityAttendRequest
	service.Parse(r, &req)

	errCode := vip.Activity.Attend(r.Context(), req)
	if errCode != model.SuccessCode {
		net.NewResponse(r).ResponseException(net.NewException(errCode))
	}
	net.NewResponse(r).ResponseOk()
}
